#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include <QTextEdit>
#include <QLabel>
#include <QLineEdit>
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QUdpSocket>
#include <QHostAddress>
#include <QTimer>
#include "base.h"


class mainWidget : public QWidget
{
    Q_OBJECT

public:
    mainWidget(QWidget *parent = 0);
    ~mainWidget();

public slots:
    void CloseBtnClicked();
    void dataRecv();
    void doLogin();
    void doChat();
    void doQuit();

private:
    QTextEdit   *ReceiveTextEdit;
    QLineEdit   *SendLineEdit;

    QLabel      *nameLabel;
    QLineEdit   *nameLineEdit;
    QLabel      *portLabel;
    QLineEdit   *portLineEdit;
    QLabel      *ServerAddressLabel;
    QLineEdit   *ServerAddressLineEdit;
    QLabel      *ServerPortLabel;
    QLineEdit   *ServerPortLineEdit;

    QPushButton *LoginBtn;
    QPushButton *ChatBtn;
    QPushButton *QuitBtn;
    QPushButton *CloseBtn;
    QHBoxLayout *mainLayout;


    QHostAddress    ServerAddress;
    int             Serverport;

    int             Clientport;
    MSG_t sendmsg;

    QUdpSocket *udpSocket;
};
#endif // MAINWIDGET_H
